
import java.util.HashMap;
import java.util.Map;

public class Garage<T extends Vehicle>
{
    private int _maxNumberOfVehicles;
    // create HashMap to store String keys and Vehicles values
    private Map<String,T> _vehicles = new HashMap<>();

    public Garage(int maxNumberOfVehicles)
    {
        _maxNumberOfVehicles = maxNumberOfVehicles;
    }

    public void add(T vehicle) throws FullException
    {
        if (_vehicles.size() == _maxNumberOfVehicles)
            throw new FullException();
        else
            _vehicles.put(vehicle.getLicense(), vehicle);
    }

    public T get(String license)
    {
        return _vehicles.get(license);
    }

    public boolean remove(String license)
    {
        return _vehicles.remove(license) != null;
    }
}


